package simu.testers;

import java.util.Scanner;
import java.util.Timer;

/**
* An example on multiple timers.
* @author http://www.gammelsaeter.com/programming/simple-timer-example-in-java/
*/
public class TimerExample {

	public static void main(String[] args) {
		Timer timer1 = new Timer();             // Get timer 1
		Timer timer2 = new Timer();             // get timer 2

		long delay1 = 5*1000;                   // 5 seconds delay
		long delay2 = 3*1000;                   // 3 seconds delay

		// Schedule the two timers to run with different delays.
		timer1.schedule(new Task("object1"), 0, delay1);
		timer2.schedule(new Task("Object2"), 0, delay2);
		
		String temp = "";
		Scanner in = new Scanner(System.in);
		
		while (!temp.equals("done")){
			temp = in.nextLine();
			System.out.println(temp);
		}
		
		timer1.cancel();
		
	}

}